import request from '@/utils/request'

export default {
    // 获取教师列表
    getAll(page, limit, teacherQuery) {
        return request({
            url: `/service_edu/teacher/getAll/${page}/${limit}`,
            method: 'post',
            data: teacherQuery,
        })
    },
    // 获取教师列表用于下拉菜单
    getAllForSelect() {
        return request({
            url: `/service_edu/teacher/AllTeachersForSelect`,
            method: 'get'
        })
    },
    // 删除教师
    delete(id) {
        return request({
            url: `/service_edu/teacher/${id}`,
            method: 'delete'
        })
    },
    // 添加教师
    add(teacher) {
        return request({
            url: `/service_edu/teacher/addTeacher`,
            method: 'post',
            data: teacher
        })
    },
    // 添加教师
    getOne(id) {
        return request({
            url: `/service_edu/teacher/${id}`,
            method: 'get'
        })
    },
    // 修改教师
    updateById(id, teacher) {
        return request({
            url: `/service_edu/teacher/${id}`,
            method: 'post',
            data: teacher
        })
    },
    // todo 导出全部教师
    export(teacherQuery) {
      return request({
        url: `/service_edu/teacher/exportAllTeachers`,
        method: 'post',
        data: teacherQuery,
        responseType: 'blob',
        headers: {'Accept': 'application/octet-stream'}
      })
    }
}
